
import http from '@src/util/http';

const prefix = '/api/user/outside'

/**
 * @description 启用停用用户
 * @returns {*}
 */
export function userEnable(params) {
  return http.get(`${prefix}/user/enable`, params)
}

/**
 * @description 指定角色 服务商列表
 * @returns {*}
 */
 export function GetProviderList(params) {
  return http.post(`${prefix}/provider/role/getProviderList`, params)
}

/**
 * @description 用户列表查询
 * @returns {*}
 */
export function userList(params) {
  return http.post(`${prefix}/user/getUserList`, params)
}

/**
 * @description 删除用户
 * @returns {*}
 */
export function userDelete(params) {
  return http.get(`${prefix}/user/delete`, params)
}

/**
 * @description 恢复用户
 * @returns {*}
 */
export function userResume(params) {
  return http.get(`${prefix}/user/resume`, params)
}

/**
 * @description 添加成员
 * @returns {*}
 */
export function userCreateAndAddDepartmentUser(params) {
  return http.post(`${prefix}/user/createAndAddDepartmentUser`, params)
}

/**
 * @description 角色增加用户
 * @returns {*}
 */
export function roleAddUser(params) {
  return http.post(`${prefix}/role/user/add`, params, false)
}

/**
 * @description 角色树查询
 * @returns {*}
 */
export function getRoleTree(params) {
  return http.get(`${prefix}/role/getRoleTree`, params)
}

/**
 * @description 工程师角色列表
 * @returns {*}
 */
export function getEngineerTree(params){
  return http.get(`${prefix}/provider/role/engineer/list`, params)
}

/**
 * @description 服务商角色树查询
 * @returns {*}
 */
 export function getRoleServiceTree(params){
  return http.get(`${prefix}/provider/role/list`, params)
}

/**
 * @description 角色列表查询
 * @returns {*}
 */
export function getRoleTreeByUser(params) {
  return http.get(`${prefix}/role/getRoleTreeByUser`, params)
}

/**
 * @description 删除角色
 * @returns {*}
 */
export function roleDelete(params) {
  return http.post(`${prefix}/role/delete/${params.id}`, {}, false)
}

/**
 * @description 工程师重置角色
 * @returns {*}
 */
export function engineerRoleDelete(params) {
    return http.get(`${prefix}/role/delete/provider`, params)
}

/**
 * @description 删除角色中的用户
 * @returns {*}
 */
export function roleDeleteUser(params) {
  return http.post(`${prefix}/role/user/delete`, params, false)
}

/**
 * @description 删除服务商角色中的用户
 * @returns {*}
 */
 export function roleServiceDeleteUser(params) {
  return http.post(`${prefix}/tenant/provider/user/unbindUser`, params)
}

/**
 * @description 服务商从角色中删除
 * @returns {*}
 */
export function removeProvider(params = {}) {
  return http.post('/api/user/outside/provider/role/provider/remove', params)
}


/**
 * @description 分配角色
 * @returns {*}
 */
export function roleAssignRoles(params) {
  return http.post(`${prefix}/role/assignRoles`, params, false)
}

/**
 * @description 自动分配角色
 * @returns {*}
 */
export function roleAutoAuthSave(params) {
  return http.get(`${prefix}/role/autoAuth/save`, params)
}

/**
 * @description 角色列表查询(根据选择的用户展示不同的角色列表),接口用于角色管理中的用户编辑页面
 * @returns {*}
 */
export function roleGetRoleTreeByUser(params) {
  return http.get(`${prefix}/role/getRoleTreeByUser`, params)
}

/**
 * @description 获取当前租户能使用的用户量与使用量
 * @returns {*}
 */
export function tenantGetBuyAndUseUserNum(params) {
  return http.get(`${prefix}/tenant/getBuyAndUseUserNum`, params)
}

/**
 * @description 获取当前租户能使用的用户量与使用量
 * @returns {*}
 */
export function resetPwdUpdateAdmin(params) {
  return http.post(`${prefix}/multi/pwd/update/admin`, params, true)
}

/**
 * @description 保存角色权限数据
 * @returns {*}
 */
export function roleAuthUpdate(params) {
  return http.post(`${prefix}/authority/update`, params)
}

/**
 * @description 检查角色名称
 * @returns {*}
 */
export function roleCheckName(params) {
  return http.get(`${prefix}/role/checkName`, params)
}

/**
 * @description 检查角色名称
 * @returns {*}
 */
 export function roleCheckRoleName(params) {
  return http.post(`${prefix}/authority/checkRoleName`, params)
}

/**
 * @description 查导出加密
 * @returns {*}
 */
export function roleQueryShieldPhone(params) {
  return http.get(`${prefix}/authority/queryShieldPhone`, params)
}

/**
 * @description 更新导出加密
 * @returns {*}
 */
export function roleDisPlayOrHidePhone(params) {
  return http.post('/security/role/disPlayOrHidePhone', params)
}

/**
 * @description 获取角色权限
 * @returns {*}
 */
export function getRoleAuth(params) {
  return http.get('/api/user/outside/authority/edit/getEditAuthority', params)
}

/**
 * @description 获取服务商角色权限
 * @returns {*}
 */
export function getRoleServiceAuth(params) {
  return http.get('/api/user/outside/authority/edit/getEditProviderAuthority', params)
}
/**
 * @description 工程师角色权限
 * @returns {*}
 */
 export function getEditEngineerAuthority(params) {
  return http.get('/api/user/outside/provider/role/edit/getEditEngineerAuthority', params)
}

/**
 * @description 获取默认分配的角色
 * @see http://yapi.shb.ltd/project/307/interface/api/35790
 */
export function getRoleAutoAuth() {
  return http.get('/api/user/outside/role/autoAuth/get')
}